package com.ae.shield.common.enchantment.shieldSuffix;

import net.minecraft.enchantment.Enchantment;

import javax.annotation.Nonnull;

public class Intensify extends SuffixBase {
    public Intensify(int typ) {
        super(getRate(typ));
    }

    @Override
    public float levelRate(int level, SuffixProperty property, float rate) {
        return rate * level;
    }

    private static SuffixRate getRate(int typ) {
        switch (typ) {
            case 0:
                return new SuffixRate()
                        .intensity(12f, 0);
            case 1:
                return new SuffixRate()
                        .upper(5f, 0);
            case 2:
                return new SuffixRate()
                        .floor(-5f, 0);
            case 3:
                return new SuffixRate()
                        .recovery(0.04f, 0);
            case 4:
                return new SuffixRate()
                        .close(0.06f, 0);
            case 5:
                return new SuffixRate()
                        .remote(0.06f, 0);
            case 6:
                return new SuffixRate()
                        .magic(0.06f, 0);
            case 7:
                return new SuffixRate()
                        .other(0.06f, 0);
            case 8:
                return new SuffixRate()
                        .penalty(-2f, 0);
            case 9:
                return new SuffixRate()
                        .piles(2f, 0);
            case 10:
                return new SuffixRate()
                        .cost(-0.15f, 0);
            case 11:
                return new SuffixRate()
                        .cd(-4f, 0);
            default:
                return new SuffixRate();
        }
    }

    @Override
    protected boolean canApplyTogether(@Nonnull Enchantment enchantment) {
        return !(enchantment instanceof Intensify) && super.canApplyTogether(enchantment);
    }
}
